
//scroll() 方法为滚动事件  
$(".scrollTop").click(function () {

  $('body,html').animate({
    scrollTop: 0
  }, 300);
  $(this.removeClass('active'))
  return false;

});

// 首页banner轮播
var bannerSwiper = new Swiper('.banner .swiper-container', {
  speed: 1800,
  autoplay: {
    delay: 1800,
    disableOnInteraction: false,
  },
  loop: true,
  observer: true, //修改swiper自己或子元素时，自动初始化swiper 
  observeParents: true, //修改swiper的父元素时，自动初始化swiper 
  watchOverflow: true,
  pagination: {
    el: '.banner .swiper-pagination',
    clickable: true,
  },
  navigation: {
    nextEl: '.banner .swiper-button-next',
    prevEl: '.banner .swiper-button-prev',
  },

});


// 新闻资讯

var newsSwiper = new Swiper('.news-fl .swiper-container', {
  speed: 1000,
  autoplay: {
    delay: 1800,
    disableOnInteraction: false,
  },
  loop: true,
  watchOverflow: true,
  spaceBetween: 20,
  navigation: {
    nextEl: '.news-fl .swiper-button-next',
    prevEl: '.news-fl .swiper-button-prev',
  },

});

//phone-nav
$(".menuBtn").click(function () {
  $('body').toggleClass('fixme');
  $(".header .m-box").toggleClass("active");
  $(".header .m-box nav").toggleClass("active");

});
if ($(window).width() < 1000) {
  $(".header nav ul li").click(function (event) {
    event.stopPropagation();
    $(this).find(".icon-shangjiantou").toggleClass("active").parents("li").siblings().find(".icon-shangjiantou").removeClass("active");
    $(this).find(".menu").slideToggle(300).parents("li").siblings().find(".menu").slideUp(300);
  });
  $('.m-box').click(function (event) {
    $('body').removeClass('fixme');
    $(this).removeClass('active')
    $(" .header nav").removeClass("active");
    event.stopPropagation();
  })
  $('.sideBar li').click(function () {
    $(this).toggleClass('active').siblings().removeClass('active')
  })

}



$(".form-con .form-item .form-input").focus(function () {
  $(this).parent('.form-item').find('.tip').addClass('active')

});


$(".search-btn").click(function (event) {
  $('.search-wrap').addClass('active');
  $(this).addClass('on')
  event.stopPropagation();
})


$(document).click(function (event) {
  var _con = $('.search-wrap');  // 设置目标区域
  if (!_con.is(event.target) && _con.has(event.target).length === 0) {
    $('.search-wrap').removeClass('active');
  }
  var _con2 = $('.sideBar li');  // 设置目标区域
  if (!_con2.is(event.target) && _con2.has(event.target).length === 0) {
    $('.sideBar li').removeClass('active');
  }

  var _con3 = $('.search-btn');  // 设置目标区域
  if (!_con3.is(event.target) && _con3.has(event.target).length === 0) {
    $('.search-btn').removeClass('on');
  }


});

// 加入我们
$(".job-con .item").eq(0).find('.name').addClass('active')
$(".job-con .item").eq(0).find('.sec').slideDown();
$(".job-con .item .name").click(function () {
  $(this).toggleClass('active').parents('.item').siblings().find('.name').removeClass('active');
  $(this).parent('.item').find('.sec').toggle().parents('.item').siblings().find('.sec').hide()
  if ($(this).hasClass('active')) {

    if ($(window).width() > 1000) {

      var target_top = $(this).offset().top - 96;
    }
    else var target_top = $(this).offset().top - 50;
    console.log(target_top);
    $("html,body").stop().animate({ scrollTop: target_top }, 500);
  }

})


